package com.liuzhilong.infrastructure.basic.command;

import com.liuzhilong.infrastructure.basic.command.hystrix.RemoteCommand;
import com.liuzhilong.infrastructure.basic.command.hystrix.LongtimeRemoteService;
import com.liuzhilong.infrastructure.basic.command.simple.*;

public class Launcher {
    public static void main(String[] args) {
        doHystrix();
    }

    private static final void doSimple(){
        Command oncommand = OneCommand.create(OneReceiver.instance());
        Invoker invoker = new Invoker().setCommand(oncommand);
        invoker.invoke();
        Command twcommand = TwoCommand.create(TwoReceiver.instance());
        invoker.setCommand(twcommand);
        invoker.invoke();
    }


    private static final void doHystrix(){
        RemoteCommand command = new RemoteCommand(new LongtimeRemoteService());
        String result =   command.execute();
        System.out.println(result);
    }


}
